﻿using BwTMusicModels;
using HwjUIDI.Utility.DatabaseHelper;
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BwTMusicServices.Country
{
    public class CountryServices
    {
        public List<North_Country> GetAllCountrys()
        {
            List<North_Country> Country = new List<North_Country>();
            try
            {
                string sql = "select * from North_Country";
                using (SqlDataReader dr = DatabaseFactory.GetDatabase().ExecuteDataReaderSQL(sql))
                {
                    while (dr.Read())
                    {
                        North_Country list = new North_Country();
                        list = new ModelsHelper().GetNorthCountryModels(dr);
                        Country.Add(list);
                    }
                }
            }
            catch (Exception)
            {

              
            }
            
            return Country;
        }
        public North_Country GetCountryInfo(string id)
        {
            North_Country country = new North_Country();
            try
            {
                string sql = $"select * from North_Country where CountryId='{id}'";
                using (SqlDataReader dr = DatabaseFactory.GetDatabase().ExecuteDataReaderSQL(sql))
                {
                    while (dr.Read())
                    {
                        country = new ModelsHelper().GetNorthCountryModels(dr);
                    }
                }
            }
            catch (Exception)
            {

              
            }
           
            return country;
        }
    
    }

}
